<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no" />
	<title>速翔网络</title>
	<link rel="stylesheet" type="text/css" href="../c/aui.css" />
	<style>
		body {
			background: #f3f3f3;
			color: #222;
		}

		.a {
			background: #fff;
			padding: 0.75rem;
			margin-bottom: 0.75rem;
		}

		.li {}

		.li,
		.li .l {
			display: flex;
			justify-content: flex-start;
			align-items: center;
		}

		.li .l-l {
			width: 3.8rem;
			height: 3.8rem;
			margin-right: 0.5rem;
		}

		.li .l-r {
			width: 100%;
		}

		.li .l {
			width: 100%;
			margin-right: 0.75rem;
		}

		.l-r div {
			color: #888;
			font-size: 0.65rem;
			padding: 0.1rem 0;
		}

		.l-r div.title {
			font-size: 0.85rem;
			color: #222;
			margin-bottom: 0.3rem;
		}

		.li .r {
			/*background: #f00;*/
			width: 2rem;
			height: 100%;
			height: 3.5rem;
			display: flex;
			align-items: center;
		}

		.li .r img {
			width: 0.9rem;
			text-align: center;
			margin: 0 auto;
		}

		#tiao {
			background: #FE2C55;
			border-radius: 0.15rem;
			padding: 0.1rem 0.35rem;
			;
			display: inline-block;
			color: #fff;
			font-size: 0.55rem;
		}

		#loadingNo {
			color: #222;
		}

		.a .f div {
			font-size: 0.65rem;
			padding: 0.25rem 0;
		}

		.a .f div.dizhi {
			padding-top: 0.75rem;
			line-height: 1.2rem;
		}

		.a .f div.dizhi span {
			padding: 0 0.2rem;
		}

		.hide span {
			color: #f00;
		}

		.a .f div.hide {
			font-size: 0.75rem;
		}

		.a .code {
			padding-bottom: 0.5rem;
			font-size: 0.75rem;
		}
	</style>
</head>

<body>
	<div class="aui-content">
		<script id="sx-list" type="text/x-dot-template">
			{{ for(var i=0,it=it.data; i
			< it.length; i++) { }} <div class="a">
				<div class="code">订单号：{{= it[i].code}}</div>
				<div class="li">
					<div class="l" tapmode onclick="_url({id:{{= it[i].shop_id}}},'shop_view_win')">
						<img class="l-l" src="../i/loading_a.png" suxiangw-src="{{= _img(it[i].img,api.winWidth/2.5) }}">
						<div class="l-r">
							<div class="title aui-ellipsis">{{= it[i].title}}</div>
							<div class="money">价格：{{= it[i].money}}</div>
							<div class="kucun">数量：{{= it[i].num}}</div>
						</div>
					</div>
					{{? it[i].s == 2}}
					<div class="r" tapmode onclick="shop({{= it[i].id }},'{{=it[i].dizhi.diqu}}{{= it[i].dizhi.dizhi}} {{=it[i].dizhi.xingming}} {{=it[i].dizhi.mobile}}')">
						<img src="../i/shop/dian.png">
					</div>
					{{?}}
				</div>
				<div class="f">
					{{? it[i].liuyan}}
					<div class="liuyan">用户留言：{{= it[i].liuyan}}</div>
					{{?}}
					<div class="dizhi">收货信息：<span>{{=it[i].dizhi.diqu}}{{= it[i].dizhi.dizhi}}</span><span>{{=it[i].dizhi.xingming}}</span><span>{{=it[i].dizhi.mobile}}</span></div>
					<div class="hide">订单状态：<span {{? it[i].s ==0 }}style="color:#555"{{?}}>{{= it[i].s_name}}</span></div>
					{{? it[i].kuaidi}}
					<div class=""><span>快递公司:{{= it[i].kuaidi}}</span><span class="aui-padded-l-15">快递单号:{{= it[i].danhao}}</span></div>
					{{?}}
				</div>
	</div>
	{{ } }}
	</script>
	<div class="ul" id="sx-view">
		<div id="jiazai" style="padding-top:50%"><img src="../i/loading_more.gif" /></div>
	</div>
	</div>
</body>
<script type="text/javascript" src="../j/api.js"></script>
<script type="text/javascript">
	var hide = 0
	apiready = function() {
		hide = api.pageParam['hide'];
		if (!hide) {
			url = 'shop/member_dingdan';

		} else {
			url = 'shop/member_dingdan?hide=' + hide;
		}
		_shangla(function(ret, err) {
			console.log(url)
			_list({
				url: url,
				loading: 1
			});
		})
		// 监听滚动
		api.addEventListener({
			name: 'scrolltobottom',
		}, function(ret, err) {
			if (heigutgao == 1) { // heigutgao=1开启执行 0停止执行   防止连续滚动，等加载数据之后在进行滚动。
				pagenum += 1
				_list({
					url: url,
					page: pagenum
				});
			}
		});
	}

	function a(_this) {
		$('.a').removeClass('a');
		$(_this).addClass('a');
	}

	function shop(id, text) {
		api.actionSheet({
			title: '请选择操作方式',
			cancelTitle: '取消',
			buttons: ['确认收货', '申请退款']
		}, function(ret, err) {
			if (ret.buttonIndex == 1) {
				shouhuo(id);
			} else if (ret.buttonIndex == 2) {
				tuikuan(id);
			}else if(ret.buttonIndex == 3){
				// fuzhi(text)
			}
		});
	}

	function shouhuo(id) {
		_loading();
		_ajax('shop/member_queren',function(ret,err){
			_loadingCloes();
			if(ret){
				if(ret.ret){
					_suxiangw_msg2({content:ret.ret,rightTitle:'确认'},function(ret){
						_list({
							url: url,
							loading: 1
						});
						dialogBox.close({
							dialogName: 'alert'
						});
					})
				}else{
					_msg(ret.err);
				}
			}
		},{id:id})
	}
	function tuikuan(id) {
	 	_msg('无法申请退款，请联系商家协商')
	}
</script>

</html>
